package com.zlx.xbhy.service.impl;

import com.zlx.xbhy.service.BaseService;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @Author 周罗校
 * @Description 抽取基本service的基本实现类
 * @ClassName BaseServiceImpl
 * @date 2020.10.22 15:25:31
 * 该版权归周罗校所有，最终解释权以官方为准
 */

public abstract class BaseServiceImpl<T,ID> implements BaseService<T,ID> {

    @Autowired
    private Mapper<T> mapper;

    @Override
    public int deleteByPrimaryKey(ID id) {
        return mapper.deleteByPrimaryKey(id);
    }

    @Override
    public int delete(T o) {
        return mapper.delete(o);
    }

    @Override
    public int insert(T o) {
        return mapper.insert(o);
    }

    @Override
    public int insertSelective(T o) {
        return mapper.insertSelective(o);
    }

    @Override
    public boolean existsWithPrimaryKey(ID id) {
        return mapper.existsWithPrimaryKey(id);
    }

    @Override
    public List selectAll() {
        return mapper.selectAll();
    }

    @Override
    public T selectByPrimaryKey(ID id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public int selectCount(T o) {
        return mapper.selectCount(o);
    }

    @Override
    public List select(T o) {
        return mapper.select(o);
    }

    @Override
    public T selectOne(T o) {
        return mapper.selectOne(o);
    }

    @Override
    public int updateByPrimaryKey(T o) {
        return mapper.updateByPrimaryKey(o);
    }

    @Override
    public int updateByPrimaryKeySelective(T o) {
        return mapper.updateByPrimaryKeySelective(o);
    }

    @Override
    public int deleteByExample(T o) {
        return mapper.updateByPrimaryKeySelective(o);
    }

    @Override
    public List selectByExample(T o) {
        return mapper.selectByExample(o);
    }

    @Override
    public int selectCountByExample(T o) {
        return mapper.selectCountByExample(o);
    }

    @Override
    public T selectOneByExample(T o) {
        return mapper.selectOneByExample(o);
    }

    @Override
    public int updateByExample(T o, ID id) {
        return mapper.updateByExample(o,id);
    }

    @Override
    public int updateByExampleSelective(T o, ID id) {
        return mapper.updateByExampleSelective(o,id);
    }

    @Override
    public List selectByExampleAndRowBounds(T o, RowBounds rowBounds) {
        return mapper.selectByExampleAndRowBounds(o,rowBounds);
    }

    @Override
    public List selectByRowBounds(T o, RowBounds rowBounds) {
        return mapper.selectByRowBounds(o,rowBounds);
    }
}
